From: Keir Fraser Date: Wed, 5 Aug 2009 12:49:35 +0000 (+0100) Subject: x86: Enable GNTTABOP_copy hypercall for HVMs X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13521 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=37455c343614ded2788380973c0c5334fa6cb796;p=xen.git x86: Enable GNTTABOP_copy hypercall for HVMs This requires plumbing 32-bit compat guests through the compat version of teh grant-table hypercall. Signed-off-by: Jayaraman, Bhaskar --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 1716b14b2d..16f59b2780 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1999,7 +1999,8 @@ static long hvm_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) { if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) && - (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) ) + (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) && + (cmd != GNTTABOP_copy)) return -ENOSYS; /* all other commands need auditing */ return do_grant_table_op(cmd, uop, count); } @@ -2051,6 +2052,16 @@ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { #else /* defined(__x86_64__) */ +static long hvm_grant_table_op_compat32( + unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) +{ + if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) && + (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) && + (cmd != GNTTABOP_copy)) + return -ENOSYS; /* all other commands need auditing */ + return compat_grant_table_op(cmd, uop, count); +} + static long hvm_memory_op_compat32(int cmd, XEN_GUEST_HANDLE(void) arg) { long rc = compat_memory_op(cmd, arg); @@ -2090,7 +2101,7 @@ static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = { static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op_compat32, - [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, + [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op_compat32, [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op_compat32, HYPERCALL(xen_version), HYPERCALL(event_channel_op), diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index f2e0150fa1..5d151226e9 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -128,6 +128,12 @@ compat_memory_op( unsigned int cmd, XEN_GUEST_HANDLE(void) arg); +extern int +compat_grant_table_op( + unsigned int cmd, + XEN_GUEST_HANDLE(void) uop, + unsigned int count); + extern int compat_vcpu_op( int cmd,